Skip to content

fix: use actual newline in E2E event parser buffer concatenation#714

Merged
FL4TLiN3 merged 1 commit intomainfrom
fix/e2e-event-parser
Mar 5, 2026
Merged

fix: use actual newline in E2E event parser buffer concatenation#714
FL4TLiN3 merged 1 commit intomainfrom
fix/e2e-event-parser

Conversation

@FL4TLiN3
Copy link
Contributor

@FL4TLiN3 FL4TLiN3 commented Mar 5, 2026

Summary

  • Fixed parseEvents using "\\n" (literal backslash-n, 2 chars) instead of "\n" (actual newline) when joining split lines in the buffer
  • This caused JSON.parse to fail on large events (like startRun with full instruction text) that were split across multiple stdout lines
  • The startRun event JSON grew after splitting InstructionMessage into multiple TextParts, making it more likely to exceed stdout buffer boundaries and get split
  • Also removes temporary debug logging from providers.test.ts and continue.test.ts

Root cause

When a large JSON event line gets split across multiple lines in stdout, the parser buffers it. But buffer += "\\n" + line inserted literal \n characters (not actual newlines), producing invalid JSON like ...text\nmore text... where the \n is two characters instead of a proper JSON escape sequence.

Test plan

  • All unit tests pass
  • Typecheck passes
  • E2E tests pass in CI (this was the root cause of consistent OpenAI and continue test failures)

🤖 Generated with Claude Code

The event parser was using "\\n" (literal backslash-n) to join split
lines, which corrupted JSON when large events (like startRun with full
instruction text) were split across multiple stdout lines. Changed to
"\n" (actual newline) so JSON.parse can handle multi-line event output.

Also removes temporary debug logging from E2E tests.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@FL4TLiN3 FL4TLiN3 enabled auto-merge (squash) March 5, 2026 00:00
@FL4TLiN3 FL4TLiN3 merged commit 65f19e7 into main Mar 5, 2026
11 checks passed
@FL4TLiN3 FL4TLiN3 deleted the fix/e2e-event-parser branch March 5, 2026 00:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant